﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAO;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Phone.Net.NetworkInformation;

namespace BUS
{
    public static class PublicAndStatic
    {
        public static ContentManager Content;
        public static bool IsUpdating = false;

        //-------------------------------------------------
        // hàm có tác dụng Normalize 1 giá trị value về min - max nếu vượt mức
        public static int Normalize(int value, int minValue, int maxValue)
        {
            if (minValue > value)
                value = minValue;
            if (maxValue < value)
                value = maxValue;
            return value;
        }

        //public static string URLHost = @"http://www.dnd1408.byethost15.com";
        public static string URLHost = @"http://www.sieudidong.com.vn";
        public static bool HasInternetConection()
        {
            return (NetworkInterface.NetworkInterfaceType != NetworkInterfaceType.None);
        }

        public static Uri ConvertToUri(TuDien tuDien)
        {
            string FisrtKey = Utilities.FormatInputData(tuDien.VnWord).ToUpper();
            //return new Uri(PublicAndStatic.URLHost + "/DictVideo" + FisrtKey[0] + @"/" + tuDien.MediaPath, UriKind.Absolute);
            return new Uri(PublicAndStatic.URLHost + "/DictVideo/" + tuDien.MediaPath, UriKind.Absolute);
        }
    }
}
